﻿Type=Activity
Version=6
ModulesStructureVersion=1
B4A=true
@EndOfDesignText@
#Region  Activity Attributes 
	#FullScreen: False
	#IncludeTitle: True
#End Region

Sub Process_Globals
	'These global variables will be declared once when the application starts.
	'These variables can be accessed from all modules.

End Sub

Sub Globals
	'These global variables will be redeclared each time the activity is created.
	'These variables can only be accessed from this module.

	Private clvjinqi As clsCustomListView
	Private itemstuheaderriv As ImageView
	Private itemjinqistuname As Label
	Private itemjinqistugrade As Label
	Private itemjinqievaltext As Label
	Private lstJinqi As List
	Private tecid As Int
	Private jinqinumlbl As Label
	Private Label1 As Label
	Private btnleft As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
Dim telaw As telanywhere
telaw.Initialize(Activity)

	'Do not forget to load the layout file created with the visual designer. For example:
	Activity.LoadLayout("layjinqilist")
	initviews
End Sub
Private Sub reqJinqiLst(tecid1 As Int)
	comm.showProgress("正在获取数据")
	ParseHelper.doGetReq(Me,"jq",comm.getApi(comm.apiIdx.REQJINQI),Array As String("js_id",tecid1))
End Sub
Private Sub filldata
	If lstJinqi.IsInitialized=False Then
		comm.TL("获取锦旗列表出错了!")
		Activity.Finish
		Return
	End If
	jinqinumlbl.Text=comm.getRichStr("获得 {R}{S}"&lstJinqi.Size&"{S}{R} 面锦旗").Color2(Colors.Red,"{R}").RelativeSize2(1.5,"{S}")
	Dim nhJQ As Int=110dip
	Dim nw As Int=100%x
	For i=0 To lstJinqi.Size-1
		clvjinqi.Add(CreateItemJinqi(lstJinqi.Get(i),nw,nhJQ,i),nhJQ,i)	
	Next
End Sub
Sub JobDone(thj As HttpJob)
	ProgressDialogHide
	If thj.Success Then
		Dim str As String=thj.GetString
		Dim nr As netRes=ParseHelper.getStatusData(str)
		comm.L(str)
		If nr.nCode=200 Then
			lstJinqi=ParseHelper.parseJinqi(str)
			filldata
		Else
			comm.TL("错误:"&nr.sData)
		End If
	Else
		comm.TL("网络错误:"&thj.JobName&"_"&thj.ErrorMessage)
	End If
End Sub
Private Sub initviews
	tecid=g_store.conf.Get("tecid")
	comm.setFA(btnleft,"fa-angle-left","")
	reqJinqiLst(tecid)
'	Dim jq As Jinqi
'	jq.Initialize
'	jq.evalStr="十年树木 测试语句 2016-03-25"
'	jq.sendby.Initialize
'	jq.sendby.name="王子豪"
'	jq.sendby.grade="小学三年级"
'	Dim nhJQ As Int=90dip
'	Dim nw As Int=100%x
'	For i=0 To 4
'		clvjinqi.Add(CreateItemJinqi(jq,nw,nhJQ,True),nhJQ,0)	
'	Next
	
End Sub
Private Sub CreateItemJinqi(jq As Jinqi ,w As Int,h As Int,n As Int) As Panel
	Dim p As Panel
	p.Initialize("")
	Activity.AddView(p,0,0,w,h)
	p.LoadLayout("itemjinqi")
	p.RemoveView
	comm.loadimground(jq.sendby.img,itemstuheaderriv,0,0)
	itemjinqievaltext.Text=comm.getRichStr(jq.evalStr&" {C}"&jq.sDate&"{C}").Color2(0xff999999,"{C}")
	itemjinqistugrade.Text=jq.sendby.school&" "&jq.sendby.grade
	itemjinqistuname.Text=jq.sendby.name&"(已学习:"&jq.sendby.keshi&"小时)"
	'Label1.Text=""
	Return p
End Sub
Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub ivzengsong_Click
	StartActivity(actBuyJinqi)
End Sub

Sub clvjinqi_ItemClick (Index As Int, Value As Object)
	
End Sub

Sub ivback_Click
	Activity.Finish
End Sub